<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Pitt GOT</title>

    <!-- Bootstrap core CSS -->
    <link href="../static/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="../static/starter-template.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>
  {% include "mainpage-v3.html" %}
  <br>
  <h3 align="center">Your progress towards graduation!</h3>
    
    
  <div class="progress">
    <style type="text/css">
      .progress {
        position:relative;
      }
      .progress span {
      position:absolute;
      left:0;
      width:100%;
      text-align:center;
      z-index:2;
      color:black;
      }
   </style>
    <div class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:{{graduationProgress}}%">
    <span class="progress-value">{{graduationProgress}}%</span>
    </div>
  </div>
    <div id="section">
      <h1 align="center">GPA</h1>
      Current gpa is: <b>{{studgpa}}</b><br>
      {% if studgpa >= 4 %}Awesome! Keep up the great work {{name}}!<br>
      {% else %}
        {% if studgpa >= 3 %}Good job {{name}}! Keep going strong!<br>
        {% else %}
          {% if studgpa >= 2 %}Not bad {{name}}. Push for better!<br>
          {% else %}
            {% if studgpa >= 1 %}Have to do better than that {{name}}. You can do it!<br>
            {% else %}
              {% if studgpa >= 0 %}Deep breathes {{name}}. It's never too late.<br>{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
      <h3 align="center">Calculator</h3>
      Calculate your gpa after this semester<br><br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Credits &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Grade<br>
      <form action="" id="gpaform">
        Course 1&nbsp;&nbsp;
        <input type="number" id = "Credits1" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade1">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br>
        Course 2&nbsp;&nbsp;
        <input type="number" id = "Credits2" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade2">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br>
        Course 3&nbsp;&nbsp;
        <input type="number" id = "Credits3" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade3">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br>
        Course 4&nbsp;&nbsp;
        <input type="number" id = "Credits4" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade4">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br>
        Course 5&nbsp;&nbsp;
        <input type="number" id = "Credits5" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade5">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br>
        Course 6&nbsp;&nbsp;
        <input type="number" id = "Credits6" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade6">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br>
        Course 7&nbsp;&nbsp;
        <input type="number" id = "Credits7" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade7">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br>
        Course 8&nbsp;&nbsp;
        <input type="number" id = "Credits8" min="0" max="5" value = "0">&nbsp;&nbsp;&nbsp;&nbsp;
        <select id="Grade8">
          <option value="4.0" selected="selected">A</option>
          <option value="3.7">A-</option>
          <option value="3.3">B+</option>
          <option value="3.0">B</option>
          <option value="2.7">B-</option>
          <option value="2.3">C+</option>
          <option value="2.0">C</option>
          <option value="1.7">C-</option>
          <option value="1.3">D+</option>
          <option value="1.0">D</option>
          <option value="0.7">D-</option>
          <option value="0.0">F</option>
        </select><br><br>
      </form>
      <input type="number" id="myText" readonly>
      <button onclick="myFunction()">Calculate</button>
      <script>
      function myFunction() {
          var currGPA = {{studgpa}};
          var currCredits = {{credTaken}};
          var gpacred = parseInt(currGPA)*parseInt(currCredits);

          var c1 = document.getElementById("Credits1").value;
          var c2 = document.getElementById("Credits2").value;
          var c3 = document.getElementById("Credits3").value;
          var c4 = document.getElementById("Credits4").value;
          var c5 = document.getElementById("Credits5").value;
          var c6 = document.getElementById("Credits6").value;
          var c7 = document.getElementById("Credits7").value;
          var c8 = document.getElementById("Credits8").value;

          var g1 = document.getElementById("Grade1");
          var gr1 = g1.options[g1.selectedIndex].value;
          var g2 = document.getElementById("Grade2");
          var gr2 = g2.options[g2.selectedIndex].value;
          var g3 = document.getElementById("Grade3");
          var gr3 = g3.options[g3.selectedIndex].value;
          var g4 = document.getElementById("Grade4");
          var gr4 = g4.options[g4.selectedIndex].value;
          var g5 = document.getElementById("Grade5");
          var gr5 = g5.options[g5.selectedIndex].value;
          var g6 = document.getElementById("Grade6");
          var gr6 = g6.options[g6.selectedIndex].value;
          var g7 = document.getElementById("Grade7");
          var gr7 = g7.options[g7.selectedIndex].value;
          var g8 = document.getElementById("Grade8");
          var gr8 = g8.options[g8.selectedIndex].value;
          
          var cg1 = parseInt(c1)*parseInt(gr1);
          var cg2 = parseInt(c2)*parseInt(gr2);
          var cg3 = parseInt(c3)*parseInt(gr3);
          var cg4 = parseInt(c4)*parseInt(gr4);
          var cg5 = parseInt(c5)*parseInt(gr5);
          var cg6 = parseInt(c6)*parseInt(gr6);
          var cg7 = parseInt(c7)*parseInt(gr7);
          var cg8 = parseInt(c8)*parseInt(gr8);
          gpacred =  gpacred+cg1+cg2+cg3+cg4+cg5+cg6+cg7+cg8;
          var totalcred = 0;
          totalcred = parseInt(c1)+parseInt(c2)+parseInt(c3)+parseInt(c4)+parseInt(c5)+parseInt(c6)+parseInt(c7)+parseInt(c8)+parseInt(currCredits);
          var calcGPA = 0;
          calcGPA = gpacred/totalcred


          document.getElementById("myText").value = calcGPA;
      }
      </script>
    </div>
 
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>
